package org.example.casemodule.enums;

import lombok.Data;


public enum DayOfWeek {
    /**
     * "MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"
     */
    MonDay("MONDAY", "星期一"),
    TueDay("TUESDAY", "星期二"),
    WedDay("WEDNESDAY", "星期三"),
    ThuDay("THURSDAY", "星期四"),
    FriDay("FRIDAY", "星期五"),
    SatDay("SATURDAY", "星期六"),
    SunDay("SUNDAY", "星期日");
    private String code;
    private String info;

    DayOfWeek(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public static DayOfWeek fromCode(String code) {
        for (DayOfWeek value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
    public static DayOfWeek fromInfo(String info) {
        for (DayOfWeek value : values()) {
            if (value.info.equals(info)) {
                return value;
            }
        }
        return null;
    }
    public String getCode() {
        return code;
    }
    public String getInfo() {
        return info;
    }
    @Override
    public String toString() {
        return "DayOfWeek{" +
                "code='" + code + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}
